package tedu.cn.tedu.oop2;

public class TestExtends {
    public static void main(String[] args) {
        Animal a1=new Animal();
        Cat a2=new Cat();
        Dog a3=new Dog();
        a1.eat();
        a1.show();
        a2.eat();
        a2.show();
        a3.eat();
        a3.show();
//        int aaa=a1.sum();
//       System.out.println(aaa);
//        System.out.println(aaa+10);
        Animal animal=a1.show();
        System.out.println(animal);
        animal.show();



    }
}
class Animal{
//    public int sum(){
//        return 5;
//    }
    public void eat(){
        System.out.println("小动物Animal吃啥都行");
    }

    public Animal show(){
        System.out.println("我是一只小动物");
        Animal a=new Animal();
        return a;
    }
}
class Cat extends Animal{
    @Override
    public void eat(){
        System.out.println("小猫爱吃小鱼干");
    }
    public Animal show(){
        System.out.println("我是一只小猫");
        Animal a=new Animal();
        return a;
    }
}
class Dog extends Animal{
    @Override
    public void eat(){
        System.out.println("小狗爱吃肉骨头");
    }
    public Dog show(){
        System.out.println("我是一只小狗");
       Dog d=new Dog();
       return d;
}
}
